package net.daum.hibernate.tutorial;
import java.util.Date;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class EventManager {

    public static void main(String[] args) {
    	SessionFactory sessionFactory = new Configuration().configure("net/daum/hibernate/tutorial/hibernate.cfg.xml").buildSessionFactory();
        Session session = sessionFactory.openSession();
        session.beginTransaction();

        Event theEvent = new Event();
        theEvent.setTitle("Hello");
        theEvent.setDate(new Date());
        session.save(theEvent);

        session.getTransaction().commit();
        sessionFactory.close();
    }
}